import { http } from "@/utils/http";
import { baseUrlApi } from "./utils";

export type PageResult = {
  success: boolean;
  data: {
    /** 列表数据 */
    list: Array<any>;
    /** 总数 */
    total?: number;
  };
  errMsg: "";
};

export type DataResult = {
  success: boolean;
  data?: {};
  errMsg: "";
};

export const queryChatGoodsList = (data?: object) => {
  return http.request<PageResult>("post", baseUrlApi("queryChatGoodsList"), {
    data
  });
};

export const createGoodsByType = (data?: object) => {
  return http.request<DataResult>("post", baseUrlApi("createGoodsByType"), {
    data
  });
};

export const queryAppModuleList = (data?: object) => {
  return http.request<PageResult>("post", baseUrlApi("queryAppModuleList"), {
    data
  });
};

export const addOrUpdateAppModule = (data?: object) => {
  return http.request<DataResult>("post", baseUrlApi("addOrUpdateAppModule"), {
    data
  });
};

export const deleteAppModule = (data?: object) => {
  return http.request<DataResult>("post", baseUrlApi("deleteAppModule"), {
    data
  });
};
